﻿<%@ page language="java" pageEncoding="GBK"%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
		<title>XXXX System</title>
		<link rel="stylesheet" type="text/css"
			href="ext/resources/css/ext-all.css" />
		<link rel="stylesheet" type="text/css" href="css/main.css" />
		<script type="text/javascript" src="ext/adapter/ext/ext-base.js">
        </script>
		<script type="text/javascript" src="ext/ext-all.js">
        </script>
		<script type="text/javascript">
            Ext.BLANK_IMAGE_URL = 'img/s.gif';
            
             
            Ext.onReady(function(){          				
                var simple = new Ext.FormPanel({
                    labelWidth: 75,
                    id:'userCotrol',
                    frame: true,
                  	labelAlign:'right',
                    bodyStyle: 'padding:5px 5px 0',
                    width: 350,
                    height: 100,
                  
                    defaults: {
                        width: 150
                    },
                    defaultType: 'textfield',
                    items: [{
                        fieldLabel: '用户名',
                        name: 'suserid',                   
                        allowBlank: false,
                        blankText: '请填写你的用户名'
                    }, new Ext.form.Field({
                        inputType: 'password',
                        fieldLabel: '密　码',
                        allowBlank: false,
                        listeners : {
                        	specialKey:function(field, e) {                         
                        		if (e.getKey() == Ext.EventObject.ENTER)                        		 
                        			var btn =  btnLogin;
                        			btn.focus();
                        			login(); 
                        		}
                        	},
                        name: 'spassword',
                        blankText: '请填写你的密码'
                    })
                  //  , new Ext.form.ComboBox({ // select
                  //    fieldLabel: '所属部门',
                  //      name: 'department',
                  //      triggerAction: 'all',
                  //     valueField: 'value',
                  //    displayField: 'key',
                  //    mode: 'local',
                  //    store: store
                  // })
                    ],
                   
                    
                    buttons: [{
                        text: '登录',
                        id:'btnLogin',
                        type: 'submit',
                        handler: login
                    }, {
                        text: '取消',
                        handler: function(){
                            simple.form.reset();
                        }
                    }]
                });
               
               		 
              
                var win = new Ext.Window({
                    title: 'XXXX系统',
                    width: 300,
                    iconCls : 'login',
                    height: 200,
                    closable : false,
                    collapsed : true,
                    resizable : false,
                    draggable : true,
                    items: simple
                });
                win.show();
                win.center();
            });
            var login = function(){
                       		//debugger;
                       		var simple = Ext.getCmp('userCotrol');
                            if (simple.form.isValid()) {
                                simple.form.doAction('submit', {
                                    url: 'ExtControllerServlet?requestType=form&action=loginAction.login',
                                    method: 'post',
                                    title: '请稍等',
                                    Msg: '正在加载...',
                                    params: '',
                                    success: function(form, action){
                                    	//debugger
                                    	var usercode = action.result.data.id;
                                    	window.opener=null;
                                    	
                                    	var newWin = window.open('index.jsp?usercode='+usercode,'win' + location.hostname.split(".").join("d"),'left=0,top=0,width='
                                    	+ (screen.availWidth - 10) +',height='
                                    	+ (screen.availHeight - 35) 
                                    	+',toolbar=no,menubar=no,scrollbars=no,resizable=yes,location=no,status=no');
                                    	
                                    	if(newWin.name != window.name)
                                    	{
                                    		newWin.opener=null;
                                    		window.open('','_self','');
											window.close();
										}
                                    },
                                    failure: function(form, action){
                                        Ext.Msg.alert('系统信息', "登录出错【" + action.result.message +　"】");
                                    }
                                });
                            }
                        }
            
            
        </script>
	</head>
	<body>

	</body>
</html>
